<?php //echo CHtml::errorSummary($model); ?>
<div style="clear: both;">
    <?php echo CHtml::beginForm('', 'post', array('style' => 'width: 40em;', 'class' => 'dot_form fw_20', 'enctype'=>'multipart/form-data')); ?>
    <fieldset>
        <legend><?php echo Yii::t('common', 'please_fill_table_contents'); ?></legend>
        <dl>
            <dt><?php echo CHtml::activeLabelEx($model, 'sign'); ?></dt>
            <dd>
                <div><?php echo CHtml::activeDropDownList($model, 'sign', MultiLevelCategory::model()->signOptions); ?></div>
                <?php echo CHtml::error($model, 'sign'); ?>
            </dd>

            <dt><?php echo CHtml::activeLabelEx($model, 'parent_id'); ?></dt>
            <dd>
                <div>
                <?php
                require_once(Yii::app()->basePath . '/extensions/GraphTree/tree.php');
                $datas = MultiLevelCategory::model()->getCTreeViewDatas();
                if (count($datas)) {
                    $datas = dumpArrayTree($datas);
                }
                $trees = array('1' => 'ΞΞ NODE ROOT ΞΞ');
                if (count($datas)) {
                    foreach ($datas as $data) {
                        $trees[$data['id']] = $data['levelstr'] . '⇒ ' . strip_tags($data['text']) . '《' . (string)$data['order_pos'] . '》';
                    }
                }
                echo CHtml::activeDropDownList($model, 'parent_id', $trees);
                ?>
                </div>
                <div><?php echo CHtml::error($model, 'parent_id'); ?></div>
            </dd>

            <dt><?php echo CHtml::activeLabelEx($model, 'name'); ?></dt>
            <dd>
                <div><?php
                    echo CHtml::activeTextField($model, 'name', array(
                        'size' => 60,
                        'maxlength' => 200
                    ));
                    ?>
                </div>
                <?php echo CHtml::error($model, 'name'); ?>
            </dd>

            <dt><?php echo CHtml::activeLabelEx($model, 'icon_saved_path'); ?></dt>
            <dd>
                <div><?php echo CHtml::activeFileField($model, 'icon_saved_path', array('class' => 'larges')); ?></div>
                <?php echo CHtml::error($model, 'icon_saved_path'); ?>
            </dd>
            
            <dt><?php echo CHtml::activeLabelEx($model, 'order_pos'); ?></dt>
            <dd>
                <div><?php echo CHtml::activeDropDownList($model, 'order_pos', MultiLevelCategory::model()->orderPosOptions); ?></div>
                <?php echo CHtml::error($model, 'order_pos'); ?>
            </dd>
            <dt></dt>
            <dd>
                <?php
                echo CHtml::activeHiddenField($model, 'id');
//                echo CHtml::activeHiddenField('MultiLevelCategory[parent]', $parent);
                echo CHtml::submitButton($model->isNewRecord
                    ? Yii::t('common', 'save') : Yii::t('common', 'update'), array(
                    'class' => 'btn'
                ));
                ?>
            </dd>
        </dl>
    </fieldset>
    <?php echo CHtml::endForm(); ?>
</div>